//    Copyright (c) 2009 Elwyn Malethan
//
//    This file is part of SeemoreJ.
//
//    SeemoreJ is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    SeemoreJ is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.

//    You should have received a copy of the GNU General Public License
//    along with SeemoreJ.  If not, see <http://www.gnu.org/licenses/>.

package com.malethan.seemorej.taglib;

import com.malethan.seemorej.taglib.elements.Select;

import java.util.Collection;

public class SelectTag extends ElementTag {
    //----------------------------------------------------------------------- Static Properties and Constants
    //----------------------------------------------------------------------- Static Methods
    //----------------------------------------------------------------------- Instance Properties

    Collection options;
    String optionLabel;
    String optionValue;

    //----------------------------------------------------------------------- Constructors
    //----------------------------------------------------------------------- Getters and Setters

    public void setOptions(Collection options) {
        this.options = options;
    }

    public void setOptionLabel(String optionLabel) {
        this.optionLabel = optionLabel;
    }

    public void setOptionValue(String optionValue) {
        this.optionValue = optionValue;
    }

    //----------------------------------------------------------------------- Instance Methods

    protected String constructElement() {
        Select select =  new Select();
        setCommonAttributes(select);

        setOptions(options);
        setOptionLabel(optionLabel);
        setOptionValue(optionValue);

        return select.toString();
    }

    public void release() {
        super.release();
        this.options = null;
        this.optionLabel = null;
        this.optionValue = null;
    }
}
